<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>菜鸟教程</title>
</head>
<body>
     <input type="button",id="btn",value="获取数据"/>
     <table style="width: 80%">
         <tr>
             <td>姓名</td>
             <td>年龄</td>
             <td>地址</td>
         </tr>
         <tbody id="content">

         </tbody>
     </table>

     　<script src="${pageContext.request.contextPath} https://code.jquery.com/jquery-3.1.1.min.js"></script>
       <script>
           $(function(){
               $("#btn").click(function (){
                   $.post("${pageContext.request.contextPath}/mapp/ajax",function (data){
                       console.log(data);
                       var html = "";
                       for (var i=0;i<data.length;i++){
                          html+="<tr>"+"<td>"+ data[i].name+"</td>"
                              +"<td>"+data[i].age+"</td>"
                              +"<td>"+data[i].addr+"<td>"+"<tr>"
                       }
                       $("#content".html(html));
                   })
               })
           })
       </script>
</body>
</html>v